<?php 
include 'include/functions.php';

$text = $_POST["text"];

if (!empty($_FILES)){
	
	$filename = uniqid(rand(), true) . '.jpg';
	$file_src = 'pictures/'.$filename;
	
	if(move_uploaded_file($_FILES['file']['tmp_name'], $file_src)){
		$filePath = "http://www.xeliom.com/MustDo/" . $file_src;
		saveMustDo($text, $filePath, 1);//1 means Active. In production change for 0.
		
		$message = 'Your file has been uploaded sucessfully';
	}
	else{
		$message = 'Error';
	}
} else{
	$message = "no file";
}

$data = array('MustDo' => $arrMustDo, 'status' => "ok", 'message' => $message, 'fileURL' => "");

$json = json_encode($data);

echo $json;
?>